<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>Unit Test: Navigate</title>
    <script type="text/javascript" src="../scripts/dd/dd.js"></script>
    <script type="text/javascript">
    dd({
        modules:[
            "navigate"
        ]
    }).event({
        load:function()
        {
            dd.navigate("/", function()
            {
                alert("Home");
            });
            dd.navigate("/user/(<name>[a-zA-Z0-9]+)/", function()
            {
                alert("User: " + this.name);
            });
            dd.navigate("/admin/*", function()
            {
                alert("Admin Section");
            });
            dd.navigate("/exact/match/", function()
            {
                alert("Exact Match");
            });
            dd.navigate.load();
            
            // Test Links
            dd(dd.body).empty();
            var test1 = dd(dd.body).addElement("a", "/test/", {"href":""});
            dd(test1).event({
                click:function()
                {
                    dd.navigate("user", "templarian");
                }
            });
            var test2 = dd(dd.body).addElement("a", "/admin/", {"href":""});
            dd(test2).event({
                click:function()
                {
                    dd.navigate("admin");
                }
            });
            var test3 = dd(dd.body).addElement("a", "/exact/match/", {"href":""});
            dd(test3).event({
                click:function()
                {
                    dd.navigate("exact", "match");
                }
            });
            var test4 = dd(dd.body).addElement("a", "/exact/match/fail/", {"href":""});
            dd(test4).event({
                click:function()
                {
                    dd.navigate("exact", "match", "fail");
                }
            });
            var test5 = dd(dd.body).addElement("a", "Home", {"href":""});
            dd(test5).event({
                click:function()
                {
                    dd.navigate();
                }
            });
        }
    });
    </script>
</head>
<body>
    Loading...
</body>
</html>
